# -*- coding: utf-8 -*-
# @时间：2023/11/6 9:34
# @作者：CJiaの可乐哥
# @文件名：analysis
# @软件：Pycharm2023
import random

from ninja import Router
from utils.cj_response import SuccessResponse

router = Router()


@router.get("/panel/data")
def panel(request):
    panel_list = [
        {
            'id': 1,
            'color': 'green',
            'name': '访问量',
            'date': '日',
            'count': random.randint(10000, 100000),
            'day': random.randint(10, 100),
            'moon': random.randint(10, 100),
            'title': '总访问量：',
            'total': random.randint(10000, 100000) * 2,
        },
        {
            'id': 2,
            'color': 'blue',
            'name': '销售额',
            'date': '周',
            'count': random.randint(10000, 100000),
            'day': random.randint(10, 100),
            'moon': random.randint(10, 100),
            'title': '总销售额：',
            'total': random.randint(10000, 100000) * 2,
        },
        {
            'id': 3,
            'color': 'purple',
            'name': '订单量',
            'date': '周',
            'count': random.randint(10000, 100000),
            'day': random.randint(10, 100),
            'moon': random.randint(10, 100),
            'title': '转化率：',
            'total': random.randint(10000, 100000) * 2,
        },
        {
            'id': 4,
            'color': 'orange',
            'name': '成交额',
            'date': '月',
            'count': random.randint(10000, 100000),
            'day': random.randint(10, 100),
            'moon': random.randint(10, 100),
            'title': '总成交额：',
            'total': random.randint(10000, 100000) * 2,
        },
    ]
    return SuccessResponse(data=panel_list)


@router.get("/navs")
def panel(request):
    nav_list = [
        {
            "title": "用户",
            "image": "http://127.0.0.1:8000/static/analysis/user.svg",
        },
        {
            "title": "分析",
            "image": "http://127.0.0.1:8000/static/analysis/analyse.svg",
        },
        {
            "title": "商品",
            "image": "http://127.0.0.1:8000/static/analysis/goods.svg",
        },
        {
            "title": "订单",
            "image": "http://127.0.0.1:8000/static/analysis/order.svg",
        },
        {
            "title": "票据",
            "image": "http://127.0.0.1:8000/static/analysis/bill.svg",
        },
        {
            "title": "消息",
            "image": "http://127.0.0.1:8000/static/analysis/news.svg",
        },
        {
            "title": "标签",
            "image": "http://127.0.0.1:8000/static/analysis/label.svg",
        },
        {
            "title": "配置",
            "image": "http://127.0.0.1:8000/static/analysis/setting.svg",
        },
    ]
    return SuccessResponse(data=nav_list)
